// getdatastr
export function getDateStr (addDayCount, formatter) {
  if (arguments.length === 0) {
    return null
  }
  formatter = formatter || 'y-m-d'
  const date = new Date()
  date.setDate(date.getDate() + addDayCount)
  const year = date.getFullYear()
  const month = zero(date.getMonth() + 1)
  const day = zero(date.getDate())
  const hours = zero(date.getHours())
  const minute = zero(date.getMinutes())
  const second = zero(date.getSeconds())
  const weekday = ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六']
  const week = weekday[date.getDay()]
  return formatter.replace(/y|m|d|h|i|s|w/ig, matches => {
    return {
      y: year,
      m: month,
      d: day,
      h: hours,
      i: minute,
      s: second,
      w: week
    }[matches]
  })
}